home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
ENUM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-14
|
491b
|
30 lines
enum state { red, yellow, green };
main()
{
int car;
enum state light;
light = green ;
for(car=1; car < 100; car++){
if( !(car%10) )
light = red;
else if( !(car%12) )
light = yellow;
else if( !(car%15) )
light = green;
/* here we go... */
if( light == green )
printf("VARROOOM!\n");
else if( light == yellow )
printf("Caution!\n");
else if( light == red )
printf("STOP!\n");
}
printf("Out of Gas!\n");
}